<template>
  <div class="regulateDetail-content">
          <div class="regulateDetailBox">
               <div class="header">{{particulars.enterpriseName}}</div>
                <div class="txt1">{{particulars.typeListName}}{{particulars.categoryListName}}</div>
                <div class="tableBox">
                            <div class="tr soildTop display-fx-center">
                              <div class="td">
                                    <span>所在镇/街道</span>
                              </div>
                              <div class="full" style="border-right:none">{{particulars.town}}</div>
                          </div>
              
                          <div class="tr soildTop display-fx-center">
                                <div class="td">
                                    <span>联系电话</span>
                                </div>
                                <div class="full">{{particulars.contactNumber}}</div>
                          </div>
                </div>
                <div class="tableBox">
                            <div class="tr per100 display-fx-center">
                              <div class="td">
                                    <span>详细地址</span>
                              </div>
                              <div class="full">{{particulars.addr}}</div>
                          </div>
                </div>
                <div class="tableBox">
                            <div class="tr display-fx-center">
                              <div class="td">
                                    <span>工作人员</span>
                              </div>
                              <div class="full" style="border-right:none">{{particulars.legalPerson}}</div>
                          </div>
                            <div class="tr display-fx-center">
                                <div class="td">
                                    <span>量化分级评定等级</span>
                                </div>
                                <div class="full">{{particulars.level}}</div>
                          </div>
                </div>
                <!-- 证件信息 -->
                <div class="headerBox">
                      <div class="line"></div>
                      <div class="title">证件信息</div>
                </div>
               <div class="certificateBox"> 
                     <div class="picture">
                          <el-image class="image" :src="particulars.businessLicense" fit="cover"></el-image>   
                          <div class="time">
                                 <span>营业执照</span>
                                 <span>有效期：2024.12.31-2025.12.31</span>
                          </div>    
                     </div> 
                     <div class="picture">
                          <el-image class="image" :src="particulars.sanitaryPermit" fit="cover"></el-image>
                          <div class="time">
                                 <span>公共场所卫生许可证</span>
                                 <span>有效期：{{particulars.sanitaryPermitDate}}</span>
                          </div>
                     </div>
               </div>  
                <!-- 人员信息 -->
                <div class="headerBox">
                      <div class="line"></div>
                      <div class="title">人员信息</div>
                </div>
                <div class="personBox">
                       <div class="peopleInfo" v-for="(item,index) in personnelData" :key="index + 'q'">
                             <el-image class="image" :src="item.imgUrl" fit="cover"></el-image>   
                             <div class="headline">{{item.name}}</div>  
                             <span class="proof" :class="{proofBg1:index ==0,proofBg2:index ==1,proofBg3:index ==2}">
                                  <img class="proof-icon" v-if="index == 0" src="@/assets/images/health1.png" alt="">
                                  <img class="proof-icon" v-if="index == 1" src="@/assets/images/health2.png" alt="">
                                  <img class="proof-icon" v-if="index == 2" src="@/assets/images/health3.png" alt="">
                                  {{item.holdStatus}}
                             </span>
                       </div>
                </div>
  

                <!-- 日常检查记录 -->
                <div class="headerBox">
                      <div class="line"></div>
                      <div class="title">日常检查记录</div>
                </div>
                <el-table :data="inspectData" border>
                        <el-table-column label="检查时间" align="center" prop="startTime" />
                        <el-table-column label="检查结果" align="center" prop="qualifiedStatus" >
                              <template slot-scope="scope">
                                  <span>{{scope.row?'合格':'不合格'}}</span>
                            </template>
                        </el-table-column >
                        <el-table-column label="操作" align="center">
                              <template slot-scope="scope">
                                  <el-button @click="handleDetail(scope.row)" size="mini" type="text">查看详情</el-button>
                            </template>
                         </el-table-column >
                </el-table>
                <!-- 分级评定等级变化情况 -->
                <div class="headerBox">
                      <div class="line"></div>
                      <div class="title">分级评定等级变化情况</div>
                </div>
                <el-table :data="atingGradeData" border>
                        <el-table-column label="评定时间" align="center" prop="evaluateTime" />
                        <el-table-column label="评定前等级" align="center" prop="beforeLv" />
                        <el-table-column label="评定后等级" align="center" prop="afterLv" />
                        <el-table-column label="评定原因" align="center" prop="reason" />
                </el-table>
                <div class="footer-btn">
                   <el-button class="btn" @click="goBackBtn">返回</el-button>
            </div>
          </div>

  </div>
</template>

<script>
  import { getManagementInfo,
           getPersonnelHealthy,
           getInspectList,
           getAtingGrade} from "@/api/zhangping/publicPlaceHealth";
  export default {
    data() {
      return {
         recordData:[{time:'2024-12-12',case:'还可以'},{time:'2024-12-12',case:'还可以'}],
         evaluateData:[{time:'2024-12-12',case:'还可以'},{time:'2024-12-12',case:'还可以'}],
         creditCode:null,
         particulars:{},
         personnelData:[],
         inspectData:[],
         atingGradeData:[]
      };
    },
    created() {
        this.creditCode = this.$route.query.creditCode 
        this.getManagementInfoFn()  
        this.getPersonnelHealthyFn()
        this.getInspectListFn()
        this.getAtingGradeFn()
    }, 
    methods: {
        getManagementInfoFn(){
        let data= {
            creditCode:this.creditCode
        }
         getManagementInfo(data).then(res=>{
                if(res.code == 200){
                     this.particulars = res.data
                }else{
                     this.$message.error(res.msg);  
                }    
         })
    },
   // 人员信息
    getPersonnelHealthyFn(){
         let data= {
            creditCode:this.creditCode,
            pageNum:1,
            pageSize:10
         }  
         getPersonnelHealthy(data).then(res=>{
                if(res.code == 200){
                     this.personnelData = res.data
                }else{
                     this.$message.error(res.msg);  
                }    
         })  
    },
    //  日常检查记录
    getInspectListFn(){
          let data= {
            creditCode:this.creditCode,
            pageNum:1,
            pageSize:10
         }  
         getInspectList(data).then(res=>{
                if(res.code == 200){
                     this.inspectData = res.rows
                }else{
                     this.$message.error(res.msg);  
                }    
         })  
    },
    //  分级评定等级
    getAtingGradeFn(){
          let data= {
            creditCode:this.creditCode,
            pageNum:1,
            pageSize:10
         }  
         getAtingGrade(data).then(res=>{
                if(res.code == 200){
                     this.atingGradeData = res.rows
                }else{
                     this.$message.error(res.msg);  
                }    
         })  
    },
       handleDetail(item){
              
        },
        goBackBtn(){
          this.$router.back()
        },
    }
  };
</script>
<style lang="scss" scoped>
         .display-fx-center{
             display: flex;
             align-items: center;
         }
         .per100{
             width: 100%!important;
         }
         .soildTop{
             border-top:solid 1px  #D3D8E2;
         }
         .regulateDetail-content{
              overflow-y: auto;
              position: relative;
              background-color: #fff;
              padding: 40px 20px;
              border-radius: 10px;
              height: calc( 100vh - 66px - 128px);
             .regulateDetailBox{
                    max-width: 930px;
                    margin: 0 auto;
                    padding-bottom:40px;

              }
            .header{
                 font-size: 22px;
                 font-weight: bold; 
                 color: #484848;
            }
            .txt1{
                 font-size: 12px;
                 color: #797C84;
                 margin: 20px 0;
                }
            .tableBox{
                  font-size: 14px;
                  @extend .display-fx-center;
                  .tr{
                      width: 50%;
                      height: 50px;
                      display: flex;
                      line-height: 50px;
                      .td{
                       width: 132px;
                       height: 100%;
                       border: solid 1px #D3D8E2;
                       background: #F4F8FF;
                       padding: 0 8px;
                       border-top:none;
                       border-right:none;
                       color: #797C84;
                       flex-shrink: 0;         
                   }
                   .full{
                         width: 100%;
                         height: 100%;
                         line-height: 50px;
                         border: solid 1px #D3D8E2;
                         border-top:none;  
                         padding: 0 10px;             
                      }
                  } 
            }
           .headerBox{
                font-size: 16px;
                color: #484848;
                font-weight: bold;
                margin-top:40px;
                margin-bottom:15px;
                @extend .display-fx-center;
                .line{
                  width: 4px;
                  height: 12px;
                  background: #5D85FF;
                  border-radius: 6px 6px 6px 6px;
                  margin-right:6px;
                }
             }
             .certificateBox{
                    @extend .display-fx-center;
                    justify-content: space-between;
                   .picture{
                      width: 455px;
                      height: 260px;
                      position: relative;
                      .image{
                          width: 100%;
                          height: 100%;
                      }
                      .time{
                           width: 100%;
                           height: 34px;
                           background: rgba(72,72,72,0.8);
                           color: #FFFFFF;
                           font-size: 14px;
                           padding: 0 10px;
                           position: absolute;
                           bottom: 0;
                           left: 0;
                           justify-content: space-between;
                           @extend .display-fx-center;
                      }
                   }    
             }
             .personBox{
                   justify-content: space-between;
                   @extend .display-fx-center;
                  .peopleInfo{
                        width: 221px;
                        border: 1px solid #D3D8E2;
                        padding: 15px;
                     .image{
                          width: 191px;
                          height: 303px;
                          // margin: 15px 15px 0 15px;
                     } 
                     .headline{
                         color: #484848;
                         font-size: 14px;
                         font-weight: bold;
                         margin-bottom:8px;
                     }  
                     .proof{
                          font-size: 12px;
                          padding: 5px 9px;
                          // background: #E5FFE8;
                          // color: #27C437;
                          border-radius:2px;
                          display: inline-block;
                           @extend .display-fx-center;
                          .proof-icon{
                              width: 12px;
                              height: 12px; 
                              margin-right:2px;  
                              position: relative;
                              top: 1px;
                          }
                     } 
                     .proofBg1{
                               background: #E5FFE8!important;
                               color: #27C437!important;
                          }
                          .proofBg2{
                              background: #FFF0F0!important;
                              color: #FF0F0F!important;
                          }
                          .proofBg3{
                              background: #FFF4E3!important;
                               color: #FF9D00!important;
                          }
                  }      
             }  
          }
          .footer-btn{
                 width: 100%;
                 background: #FFFFFF;
                 height: 78px;
                 position: fixed;
                 bottom: 0;
                 right: 0;
                .btn{
                   position: fixed;
                   bottom: 20px;
                   right: 20px;    
                }
                 
          }
        ::v-deep{
           .el-table__header-wrapper th{
                 background: #F4F8FF!important;    
           }
        }
</style>
